﻿<h3>
    Features - Classes - Member Overrides</h3>
<hr>
<p>
    Override members on extended classes is simple: all public method are virtual.</p>
<h4>
    Example</h4>
<pre>$.class.ns("Joo");

Joo.Enterprise = $.class.define(function() {
	_captain = "Jonathan Archer";

	var self = {
		captain: function() {
			return _captain;
		}
	};
	
	return self;
});

var enterprise = new Joo.Enterprise();
enterprise.captain(); // Jonathan Archer

Joo.StarTrek = $.class.extend(Joo.Enterprise, function() {
	_captain = "James T. Kirk";

	var self = {
		captain: function() {
			return _captain;
		},
		previousCaptain: function() {
			return self.superclass.captain();
		}
	};
	
	return self;
});

var original = new Joo.StarTrek();
original.captain();         // James T. Kirk
original.previousCaptain(); // Jonathan Archer

Joo.NextGeneration = $.class.extend(Joo.StarTrek, function() {
	_captain = "Jean-Luc Picard";

	var self = {
		captain: function() {
			return _captain;
		},
		previousCaptain: function() {
			return self.superclass.captain();
		},
		previousPreviousCaptain: function() {
			return self.superclass.previousCaptain();
		}
	};
	
	return self;
});

var nextGen = new Joo.NextGeneration();
nextGen.captain();                 // Jean-Luc Picard
nextGen.previousCaptain();         // James T. Kirk
nextGen.previousPreviousCaptain(); // Jonathan Archer</pre>
